import { createRouter, createWebHistory, RouteRecordRaw } from "vue-router";

const routes: Array<RouteRecordRaw> = [
  {
    path: "/",
    redirect: "/home",
  },
  {
    path: "/home",
    name: "/home",
    component: () => import("@/views/Home/index.vue"),
    meta: {
      title: "在线颜色转换，色彩查询颜色搭配...",
    },
  },
  {
    path: "/about",
    name: "/about",
    component: () => import("@/views/About/index.vue"),
    meta: {
      title: "关于",
    },
  },
];

const router = createRouter({
  history: createWebHistory(),
  routes,
});

router.beforeEach((to: any) => {
  document.title = to.meta.title as string;
});

export default router;
